import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class MySwingLogin {
	public static void main(String[] args) {
		//create JFrame instance
		JFrame frame = new JFrame("My Login Example");
		
		//setting the width and height of frame
		frame.setSize(350,200);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JPanel panel = new JPanel();
		frame.add(panel);
		
		placeComponents(panel);
		
		frame.setVisible(true);
		
	}
	
	private static void placeComponents(JPanel panel) {
		
		panel.setLayout(null);
		JLabel userLabel = new JLabel("User: ");
		
		userLabel.setBounds(20,10,80,50);
		panel.add(userLabel);
		
		JTextField userText = new JTextField(20);
		userText.setBounds(100,20,165,25);
		panel.add(userText);
		
		JLabel passwordLabel = new JLabel("Password: ");
		passwordLabel.setBounds(10,50,80,25);
		panel.add(passwordLabel);
		
		JPasswordField passwordText = new JPasswordField(20);
		passwordText.setBounds(100,50,165,25);
		panel.add(passwordText);
		
		JButton loginButton = new JButton("login");
		loginButton.setBounds(10,80,80,25);
		panel.add(loginButton);
		
		
	}
	
}
